$OpenBSD: patch-Makefile,v 1.2 2012/09/23 08:07:54 matthieu Exp $
--- Makefile.orig	Fri Feb 26 05:17:38 1999
+++ Makefile	Sun Jul 29 01:56:46 2001
@@ -1,39 +1,40 @@
 #  Makefile for LinCity   (c)  I J Peters 1995,1996.
 
 #       This is where the binaries for LinCity will be placed.
-LC_BINDIR = /usr/local/bin
+LC_BINDIR = $(PREFIX)/bin
 #          for solaris you might choose...
 #          LC_BINDIR = /opt/lcity/bin
 
 #       This is where the library/data files will be placed.
-LC_LIBDIR = /usr/local/lib/lincity
+LC_LIBDIR = $(PREFIX)/share/lincity
 #          for solaris you might choose...
 #          LC_LIBDIR = /opt/lcity/lib
 
 # export LC_LIBDIR
 
 #       This is where the manpage will be placed.
-LC_MANDIR = /usr/local/man/man6
+LC_MANDIR = $(PREFIX)/man/man6
 LC_MANSUF = 6
 #          for solaris you might choose...
 #          LC_LIBDIR = /opt/lcity/man/man6
 
 
 # CC = egcs
-CC = gcc
+CC = $(CXX)
 
 # EXTRA_OPTS = -fomit-frame-pointer -fstrength-reduce -ffast-math
 # EXTRA_OPTS = -fstrength-reduce -ffast-math
 WARN_OPTS  = -Wall -Wpointer-arith -Wcast-align -Winline
 # DEBUG_OPTS =-g
-CFLAGS = -O2 $(DEBUG_OPTS) $(EXTRA_OPTS) $(WARN_OPTS) -DLIBDIR=\"$(LC_LIBDIR)\"
+CFLAGS = $(CXXFLAGS) $(DEBUG_OPTS) $(EXTRA_OPTS) $(WARN_OPTS) \
+    -DLIBDIR=\"$(LC_LIBDIR)\"
 # -fno-strength-reduce
 # PROFF = -pg
 # PROFL = -lc
 # PROFD = -DCS_PROFILE
 
-LC_XFLAGS = $(CFLAGS) -DLC_X11 
-LC_XLIBS = -lXExExt -lXext -lX11
+LC_XFLAGS = $(CFLAGS) -DLC_X11 -I$(X11BASE)/include
+LC_XLIBS = -lXExExt -lXext -lX11 -L$(X11BASE)/lib
 
 XOBJS = xmain.o xmouse.o xscreen.o xmps.o xtypeinit.o xengine.o\
  xtransport.o xmarket.o xhelp.o lcx11.o
@@ -42,7 +43,7 @@ XOBJS = xmain.o xmouse.o xscreen.o xmps.
 
 #  /usr/X11R6/lib/X11/config/ is where Imake.tmpl lives, change the following
 # line if yours is somewhere else.
-LC_IMAKE_ARGS = -DUseInstalled -I/usr/X11R6/lib/X11/config
+LC_IMAKE_ARGS = -DUseInstalled -I$(LOCALBASE)/lib/X11/config
 
 dummy:
 	@echo
@@ -91,7 +92,7 @@ lincity : main.o mouse.o screen.o mps.o 
 # all the objects and libraries. 
 xlincity : $(XOBJS)
 	imake -s XMakefile $(LC_IMAKE_ARGS) LC_LIBDIR=$(LC_LIBDIR)
-	make -f XMakefile
+	$(MAKE) -f XMakefile
 
 solaris :
 	make -f sunosMakefile LC_LIBDIR=$(LC_LIBDIR)
@@ -122,28 +123,20 @@ install :
 # exists, even with the -p flag, hence the '-'. We should still
 # catch a failure with the chmod hopefully.
 	-mkdir -p $(LC_BINDIR)
-	chmod 755 $(LC_BINDIR)
-	-cp lincity $(LC_BINDIR)
-	-chmod +s $(LC_BINDIR)/lincity
-	-cp xlincity $(LC_BINDIR)
-	-chmod 755 $(LC_BINDIR)/xlincity
+	$(BSD_INSTALL_PROGRAM) xlincity $(LC_BINDIR)
 	-mkdir -p $(LC_LIBDIR)
-	chmod 755 $(LC_LIBDIR)
-	cp -r icons $(LC_LIBDIR)
-	chmod 755 $(LC_LIBDIR)/icons
-	cp -r help $(LC_LIBDIR)
-	chmod 755 $(LC_LIBDIR)/help
-	cp -r messages $(LC_LIBDIR)
-	chmod 755 $(LC_LIBDIR)/messages
-	cp -r opening $(LC_LIBDIR)
-	chmod 755 $(LC_LIBDIR)/opening
-	cp colour.pal $(LC_LIBDIR)
-	chmod -R o+r $(LC_LIBDIR)
+	$(BSD_INSTALL_DATA) colour.pal $(LC_LIBDIR)
+	-mkdir -p $(LC_LIBDIR)/icons
+	$(BSD_INSTALL_DATA) icons/* $(LC_LIBDIR)/icons
+	-mkdir -p $(LC_LIBDIR)/help
+	$(BSD_INSTALL_DATA) help/* $(LC_LIBDIR)/help
+	-mkdir -p $(LC_LIBDIR)/messages
+	$(BSD_INSTALL_DATA) messages/* $(LC_LIBDIR)/messages
+	-mkdir -p $(LC_LIBDIR)/opening
+	$(BSD_INSTALL_DATA) opening/* $(LC_LIBDIR)/opening
 	-mkdir -p $(LC_MANDIR)
-	cp lincity.man $(LC_MANDIR)/lincity.$(LC_MANSUF)
-	chmod o+r $(LC_MANDIR)/lincity.$(LC_MANSUF)
-	chmod o+rx `dirname $(LC_BINDIR)`
-	chmod o+rx `dirname $(LC_MANDIR)`
+	$(BSD_INSTALL_MAN) lincity.man $(LC_MANDIR)/lincity.$(LC_MANSUF)
+	$(BSD_INSTALL_MAN) lincity.man $(LC_MANDIR)/xlincity.$(LC_MANSUF)
 
 uninstall:
 	-rm $(LC_BINDIR)/lincity
